package cn.iocoder.yudao.module.crossborder.platform.dal.mysql.platformsynctask;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crossborder.platform.dal.dataobject.platformsynctask.PlatformSyncTaskDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crossborder.platform.controller.admin.platformsynctask.vo.*;

/**
 * 跨境电商数据同步任务 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PlatformSyncTaskMapper extends BaseMapperX<PlatformSyncTaskDO> {

    default PageResult<PlatformSyncTaskDO> selectPage(PlatformSyncTaskPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PlatformSyncTaskDO>()
                .eqIfPresent(PlatformSyncTaskDO::getPlatformId, reqVO.getPlatformId())
                .eqIfPresent(PlatformSyncTaskDO::getStoreId, reqVO.getStoreId())
                .eqIfPresent(PlatformSyncTaskDO::getSyncType, reqVO.getSyncType())
                .eqIfPresent(PlatformSyncTaskDO::getSyncDirection, reqVO.getSyncDirection())
                .eqIfPresent(PlatformSyncTaskDO::getBusinessType, reqVO.getBusinessType())
                .eqIfPresent(PlatformSyncTaskDO::getBusinessId, reqVO.getBusinessId())
                .eqIfPresent(PlatformSyncTaskDO::getBatchNo, reqVO.getBatchNo())
                .eqIfPresent(PlatformSyncTaskDO::getPriority, reqVO.getPriority())
                .betweenIfPresent(PlatformSyncTaskDO::getScheduledTime, reqVO.getScheduledTime())
                .betweenIfPresent(PlatformSyncTaskDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(PlatformSyncTaskDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(PlatformSyncTaskDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PlatformSyncTaskDO::getProgress, reqVO.getProgress())
                .eqIfPresent(PlatformSyncTaskDO::getTotalCount, reqVO.getTotalCount())
                .eqIfPresent(PlatformSyncTaskDO::getSuccessCount, reqVO.getSuccessCount())
                .eqIfPresent(PlatformSyncTaskDO::getFailedCount, reqVO.getFailedCount())
                .eqIfPresent(PlatformSyncTaskDO::getErrorMsg, reqVO.getErrorMsg())
                .eqIfPresent(PlatformSyncTaskDO::getRequestData, reqVO.getRequestData())
                .eqIfPresent(PlatformSyncTaskDO::getResponseData, reqVO.getResponseData())
                .eqIfPresent(PlatformSyncTaskDO::getRetryCount, reqVO.getRetryCount())
                .eqIfPresent(PlatformSyncTaskDO::getMaxRetryCount, reqVO.getMaxRetryCount())
                .betweenIfPresent(PlatformSyncTaskDO::getNextRetryTime, reqVO.getNextRetryTime())
                .betweenIfPresent(PlatformSyncTaskDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PlatformSyncTaskDO::getId));
    }

}